Function Reference

_AD_ErrorNotify

Set or query the debug level.

#Include <AD.au3>
_AD_ErrorNotify($iDebug[, $sDebugFile = @ScriptDir & "\AD_Debug.txt"])

 

Parameters

$iDebug Debug level. Allowed values are:
-1 - Return the current settings
0 - Disable debugging
1 - Enable debugging. Output the debug info to the console
2 - Enable Debugging. Output the debug info to a MsgBox
3 - Enable Debugging. Output the debug info to a file defined by $sDebugFile
4 - Enable Debugging. The COM errors will be handled (the script no longer crashes) without any output
$sDebugFile Optional: File to write the debugging info to if $iDebug = 3 (Default = @ScriptDir & "\AD_Debug.txt")

 

Return Value

Success (for $iDebug =: 1) - one based one-dimensional array with the following elements:
    1 - Debug level. Value from 0 to 3. Check parameter $iDebug for details
    2 - Debug file. File to write the debugging info to as defined by parameter $sDebugFile
    3 - True if the COM error handler has beend set for this UDF. False if debugging is set off or another COM error handler was already stt
Success (for $iDebug = 0): 1
Success (for $iDebug => 0): 1, sets @extended to:
    0 - The COM error handler for this UDF was already active
    1 - A COM error handler has successfully been initialized for this UDF
Failure: 0, sets @error to:
    1 - $iDebug is not an integer or < -1 or > 4
    2 - Installation of the custom error handler failed. @extended is set to the error code returned by ObjEvent
    3 - COM error handler already set to another function

 

Remarks

None.

 

Related

 

Example


#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y
#include <AD.au3>

; Open Connection to the Active Directory
_AD_Open()
If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended)

; *****************************************************************************
; Example 1
; Set the debugging options to MsgBox.
; *****************************************************************************
_AD_ErrorNotify(2)
If @error Then MsgBox(16, "Active Directory Example Skript", "Function _AD_ErrorNotify encountered a problem. @error = " & @error & ", @extended = " & @extended)
; Provoke a COM error
_AD_GetObjectAttribute(@UserName, "xyz")

; *****************************************************************************
; Example 2
; Set the debugging option to file and set the filename.
; Query the debugging options and display the resulting array.
; *****************************************************************************
; Set the debugging options
_AD_ErrorNotify(3, "C:\temp\AD_Loggin.txt")
If @error Then MsgBox(16, "Active Directory Example Skript", "Function _AD_ErrorNotify encountered a problem. @error = " & @error & ", @extended = " & @extended)
; Query the debugging options
Global $aResult = _AD_ErrorNotify(-1)
If @error Then MsgBox(16, "Active Directory Example Skript", "Function _AD_ErrorNotify encountered a problem. @error = " & @error & ", @extended = " & @extended)
_ArrayDisplay($aResult)

; Close Connection to the Active Directory
_AD_Close()